#include <iostream>  
#include <iomanip>  
#include <sstream>  
  

std::string rgb2hex(int r, int g, int b, bool with_head = false);
std::string rgb2hex(int r, int g, int b, bool with_head)
{
	std::stringstream ss;
	if (with_head)
		ss << "#";
	ss << std::hex << (r << 16 | g << 8 | b);
	return ss.str();
}
  
int main() {  
    int r = 255;  
    int g = 0;  
    int b = 0;  
  
    std::string hex = rgb2hex(r, g, b);  
  
    std::cout << "RGB: (" << r << ", " << g << ", " << b << ")" << std::endl;  
    std::cout << "Hex: #" << hex << std::endl;  
  
    return 0;  
}